package com.sghd.football.module.game.service.thread;

import com.sghd.common.utils.concurrent.DelayedElement;
import com.sghd.football.module.game.service.core.Desk;

import java.util.Date;
import java.util.Objects;

/**
 * 超时未传入操作数据的战斗任务
 */
public class TaskItem extends DelayedElement<Task> {
    public static final int DESK = 0;
    public static final int MATCH = 1;
    /** 桌子id*/
    private Desk desk;
    /** 类型*/
    private int type;

    public TaskItem(Desk desk, Task task, Date end) {
        super(task, end);
        this.desk = desk;
        this.type = DESK;
    }
    public TaskItem(Desk desk, Task task, Date end, int type) {
        super(task, end);
        this.desk = desk;
        this.type = type;
    }

    public TaskItem(Task task, Date end) {
        super(task, end);
    }

    public Desk getDesk() {
        return desk;
    }

    public int getType() {
        return type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        TaskItem taskItem = (TaskItem) o;
        return Objects.equals(desk, taskItem.desk);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), desk);
    }
}
